const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_cmmn_ru_sentry_part_inst', {
    id: {
      type: DataTypes.STRING(255),
      allowNull: false,
      primaryKey: true,
      field: 'ID_'
    },
    rev: {
      type: DataTypes.INTEGER,
      allowNull: false,
      field: 'REV_'
    },
    caseDefId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      references: {
        model: 'act_cmmn_casedef',
        key: 'id_'
      },
      field: 'CASE_DEF_ID_'
    },
    caseInstId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      references: {
        model: 'act_cmmn_ru_case_inst',
        key: 'id_'
      },
      field: 'CASE_INST_ID_'
    },
    planItemInstId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      references: {
        model: 'act_cmmn_ru_plan_item_inst',
        key: 'id_'
      },
      field: 'PLAN_ITEM_INST_ID_'
    },
    onPartId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'ON_PART_ID_'
    },
    ifPartId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'IF_PART_ID_'
    },
    timeStamp: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'TIME_STAMP_'
    }
  }, {
    sequelize,
    tableName: 'act_cmmn_ru_sentry_part_inst',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_" },
        ]
      },
      {
        name: "ACT_IDX_SENTRY_CASE_DEF",
        using: "BTREE",
        fields: [
          { name: "CASE_DEF_ID_" },
        ]
      },
      {
        name: "ACT_IDX_SENTRY_CASE_INST",
        using: "BTREE",
        fields: [
          { name: "CASE_INST_ID_" },
        ]
      },
      {
        name: "ACT_IDX_SENTRY_PLAN_ITEM",
        using: "BTREE",
        fields: [
          { name: "PLAN_ITEM_INST_ID_" },
        ]
      },
    ]
  });
};
